package cn.controller;

import cn.domain.Student;
import cn.domain.Sysuser;
import cn.service.CustomerService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author Vijay
 * @date 2020/3/30  -13:56
 */
@Controller

public class CustomerController {
    @Autowired
    private CustomerService customerService;
    @RequestMapping("/stuList")
    public String findCustomList(@RequestParam(value="pn",defaultValue="1")Integer pn, Model model )
    {
        String  relsut="customersList";
        //引入分页插件
        PageHelper.startPage(pn,7);
        //查询所有学生列表
        List<Sysuser> customers = customerService.findCustomerList();
        //显示前5页的
        PageInfo pageInfo=new PageInfo(customers,5);

        model.addAttribute("pageInfo", pageInfo);


        return relsut;

    }
}
